﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Collections.Generic;
using System.ComponentModel;
using System.Net;
using System.IO;
namespace WechatSDK
{
    public partial class Add_Image : System.Web.UI.Page
    {
        public string appId = "";
        public string timestamp = "";
        public string nonceStr = "";
        public string signature = "";
        public string lr = "";
        protected void Page_Load(object sender, EventArgs e)
        {
           // if (!IsPostBack)
           //{
                Hashtable ht = JSSDK.getSignPackage();
                appId = ht["appId"].ToString();
                nonceStr = ht["nonceStr"].ToString();
                timestamp = ht["timestamp"].ToString();
                signature = ht["signature"].ToString();


          //  }

           /// Image1.ImageUrl = "wxLocalResource://4957294421901138";
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Response.Write("<script type='text/javascript'>scanQRCode();</script>");


        }
        public string showimage()
        {
            System.Collections.Specialized.NameValueCollection nc = new System.Collections.Specialized.NameValueCollection(Request.Form);
            //TextBox1.Text = nc.GetValues("hide_file")[0].ToString();

            string mediaid = nc.GetValues("hide_file")[0].ToString();
            Image1.ImageUrl = mediaid;
            return "2";
        
        }
        protected void Button1_Click1(object sender, EventArgs e)
        {

            System.Collections.Specialized.NameValueCollection nc = new System.Collections.Specialized.NameValueCollection(Request.Form);
            //TextBox1.Text = nc.GetValues("hide_file")[0].ToString();

            string mediaid = nc.GetValues("hide_file")[0].ToString();

            string token=JSSDK.GetExistAccessToken();
            string urlFormat = "http://qyapi.weixin.qq.com/cgi-bin/media/get?access_token={0}&media_id={1}";


            string stUrl = string.Format(urlFormat, token, mediaid);

            Image1.ImageUrl = mediaid;
        }
    }
}